﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="run.aspx.cs" Inherits="www.pages.sys.run" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link href="../../plugins/layer/theme/default/layer.css" rel="stylesheet" />
    <link href="../../css/lanai-ui.min.css" rel="stylesheet" />
</head>
<body>
    <section class="content no-padding">
        <form id="form1" runat="server">
            <div class="box box-widget no-shadow no-radius-childs">
                <div class="box-body">
                    <asp:Repeater ID="list_docs" runat="server">
                        <HeaderTemplate>
                            <table class="table table-bordered table-striped table-hover text-center list_docs">
                                <thead>
                                    <tr>
                                        <th style="width: 60px">选择</th>
                                        <th>文档名称</th>
                                        <th style="width: 60px">操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <tr>
                                <td>
                                    <input type="checkbox" data-doc="<%#Eval("doc_id") %>" /></td>
                                <td><%#Eval("doc_name") %></td>
                                <td>
                                    <a href="#" class="btn btn-sm btn-success" onclick="ShowPreview('<%#Eval("project_id") %>','<%#Eval("doc_id") %>')"><i class="fa fa-play"></i></a>
                                </td>
                            </tr>
                        </ItemTemplate>
                        <FooterTemplate>
                            </tbody>
                    </table>
                        </FooterTemplate>
                    </asp:Repeater>
                </div>
                <div class="box-footer navbar-fixed-bottom">
                    <div class="row">
                        <div class="col-sm-6 col-xs-6">
                            <div class="checkbox checkbox-inline checkbox-primary">
                                <input id="cb_selectAll" type="checkbox" />
                                <label for="cb_selectAll">
                                    全选
                                </label>
                            </div>
                        </div>
                        <div class="col-sm-6 col-xs-6">
                            <a href="#" class="btn btn-success btn-sm pull-right" id="btnRun"><i class="fa fa-play"></i>运行</a>
                        </div>
                    </div>
                </div>
            </div>
            <input type="hidden" id="hid_Project" runat="server" value="0" />
        </form>

    </section>
    <script src="../../js/jquery.min.js"></script>
    <script src="../../plugins/layer/layer.js"></script>
    <script src="../../js/lanai-ui.min.js"></script>
    <script src="../../js/common.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#cb_selectAll").click(function () {
                if ($(this).is(":checked")) {
                    $(".list_docs tbody input[type='checkbox']").attr("checked", "true");
                }
                else {
                    $(".list_docs tbody input[type='checkbox']").removeAttr("checked");
                }
            });

            $("#btnRun").click(function () {
                var selected = 0;
                var docs = "";
                $(".list_docs tbody input[type='checkbox']:checked").each(function (i, el) {
                    selected++;
                    docs += $(el).data("doc")+",";
                });
                if (selected <= 0) {
                    layer.alert("请至少选取一个文档");
                    return;
                }
                if (docs != "") {
                    docs = docs.substr(0, docs.length - 1);
                }
                ShowPreview($("#hid_Project").val(), docs);
            });
        });
    </script>
</body>
</html>
